# Maintainer: Daniel Bermond <dbermond@archlinux.org>

pkgname=kvazaar
pkgver=2.2.0
pkgrel=1
pkgdesc='An open-source HEVC encoder'
arch=('loong64' 'x86_64')
url='https://github.com/ultravideo/kvazaar/'
license=('BSD')
depends=('crypto++')
makedepends=('git' 'yasm')
checkdepends=('ffmpeg' 'hm')
source=("git+https://github.com/ultravideo/kvazaar.git#tag=v${pkgver}"
        'git+https://github.com/ultravideo/greatest.git')
sha256sums=('SKIP'
            'SKIP')

prepare() {
    git -C kvazaar submodule init
    git -C kvazaar config --local submodule.greatest.url "${srcdir}/greatest"
    git -C kvazaar -c protocol.file.allow='always' submodule update
    autoreconf -fi kvazaar
}

build() {
    cd kvazaar
    ./configure --prefix='/usr' --with-cryptopp
    make
}

check() {
    make -C kvazaar check
}

package() {
    make -C kvazaar DESTDIR="$pkgdir" install
    install -d -m755 "${pkgdir}/usr/share/licenses/kvazaar"
    mv "${pkgdir}/usr/share/doc/kvazaar"/LICENSE* "${pkgdir}/usr/share/licenses/${pkgname}"
}
